import React from 'react'

class DigitalClock extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            date: new Date()
        }
    }

    componentDidMount() {
        this.timer = setInterval(() => {
            this.setState({
                date: new Date()
            })
        }, 1000)
    }

    componentDidUpdate() {
        
    }

    componentWillUnmount() {
        clearInterval(this.timer)
    }
    render() {
        return (
            <div className="jumbotron">
                <h1 className="display-4">{ this.state.date.toLocaleString() }</h1>
            </div>
        )
    }

}


export default DigitalClock